import request from '@/utils/request';

interface ReservationListParams {
  page?: number;
  pageSize?: number;
  status?: string;
  searchText?: string;
  sortBy?: string;
  sortOrder?: string;
}
/**
 * 获取预约列表（支持分页、排序、筛选）
 * @param params 查询参数
 * @returns 
 */
export async function getReservationListAPI(params: ReservationListParams = {}) {
  return request.post('/rooms/reservationList', params);
};

/**
 * @description 根据 id 获取预约信息
 * @param id 预约 id
 * @returns 
 */
export async function getReservationByIdAPI(id: string) {
  return request.get(`/rooms/reservations/${id}`);
};

/**
 * 管理员审批
 * @param id 预约 id
 * @param status 审批状态
 * @returns 
 */
export async function approveReservationAPI(id: string, status: string) {
  return request.put(`/rooms/reservations/${id}/approve`, { status });
};

/**
 * @description 获取预约统计信息
 */
export async function getReservationStatisticsAPI() {
  return request.get('/rooms/stats/reservations');
};
